const questions = [
  {
    category: "py",
    question: "Which is one of the basic data types in python?",
    choices: ["int", "long", "char"],
    answer: "int"
  },
  {
    category: "js",
    question: "Which is one of the basic data types in JavaScript?",
    choices: ["int", "long", "number"],
    answer: "number"
  },
  {
    category: "c",
    question: "Which is one of the basic data types in C?",
    choices: ["int", "str", "number"],
    answer: "int"
  },
  {
    category: "bash",
    question: "Which is one of the bash commands?",
    choices: ["ls", "dir", "New-Item"],
    answer: "ls"
  },
  {
    category: "hello",
    question: "Hello?",
    choices: ["world", "python", "JavaScript"],
    answer: "world"
  }
];

const getRandomQuestion = arr => {
  const randomQuesIndex = Math.floor(Math.random() * arr.length);
  return arr[randomQuesIndex];
}

const getRandomComputerChoice = choices => {
  const randomChoiceIndex = Math.floor(Math.random() * choices.length);
  return choices[randomChoiceIndex];
}

const getResults = (question, choice) => {
  if (choice === question.answer) {
    return "The computer's choice is correct!";
  } else {
    return `The computer's choice is wrong. The correct answer is: ${question.answer}`;
  }
}

